/*
 * Wazuh Vulnerability Scanner - Unit Tests
 * Copyright (C) 2015, Wazuh Inc.
 * January 2, 2024.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */

#ifndef _EVENT_DETAILS_BUILDER_TEST_HPP
#define _EVENT_DETAILS_BUILDER_TEST_HPP

#include "databaseFeedManager.hpp"

#include "MockDatabaseFeedManager.hpp"
#include "TrampolineOsDataCache.hpp"
#include "TrampolineRemediationDataCache.hpp"
#include "policyManager.hpp"
#include "scanContext.hpp"
#include "socketServer.hpp"
#include "gtest/gtest.h"
#include <filesystem>

/**
 * @brief Runs unit tests for EventDetailsBuilder.
 *
 */
class EventDetailsBuilderTest : public ::testing::Test
{
protected:
    // LCOV_EXCL_START
    EventDetailsBuilderTest() = default;
    ~EventDetailsBuilderTest() override = default;

    /**
     * @brief Set the environment for testing.
     *
     */
    void SetUp() override;

    /**
     * @brief Clean the environment after testing.
     *
     */
    void TearDown() override;
    // LCOV_EXCL_STOP
};

/**
 * @brief Runs unit tests for EventDetailsBuilder.
 *
 */
class EventDetailsBuilderAdpTest : public ::testing::Test
{
protected:
    // LCOV_EXCL_START
    EventDetailsBuilderAdpTest() = default;
    ~EventDetailsBuilderAdpTest() override = default;

    /**
     * @brief Set the environment for testing.
     *
     * @param adp Set adp short name.
     */
    void SetUp(const std::string& adp);

    /**
     * @brief Clean the environment after testing.
     *
     */
    void TearDown() override;

    /**
     * @brief DatabaseFeedManager mock instance.
     *
     */
    std::shared_ptr<MockDatabaseFeedManager> m_spDatabaseFeedManagerMock;

    /**
     * @brief RocksDBWrapper instance.
     *
     */
    std::unique_ptr<Utils::RocksDBWrapper> m_rocksDbWrapper;

    /**
     * @brief ScanContext instance.
     *
     */
    std::shared_ptr<TScanContext<TrampolineOsDataCache, GlobalData, TrampolineRemediationDataCache>> m_scanContext;

    /**
     * @brief Buffer pointer.
     *
     */
    uint8_t* m_buffer;

    /**
     * @brief Flatbuffer parser
     *
     */
    flatbuffers::Parser m_parser;

    /**
     * @brief Flatbuffer builder
     *
     */
    flatbuffers::FlatBufferBuilder m_fbBuilder;

    /**
     * @brief Test the returned adp description.
     *
     * @param adp ADP short name.
     */
    void TestingAdpDescription(const std::string& adp);
    // LCOV_EXCL_STOP
};

#endif // _EVENT_DETAILS_BUILDER_TEST_HPP
